<?php

// Created by Khanh Nam
class LocationMenu extends CWidget{
 
    public $customer;
    public $location;
    public $contacts;
    public function init(){
        
        if($this->location!=NULL){
            $this->contacts=Locationcontacts::model()->findAll('custno=:custno AND locno=:locno',array(
                'custno'=>$this->location->custno,
                'locno'=>$this->location->locno,
            ));
            
            $this->customer=Customers::model()->find('custno=:custno',array(
                'custno'=>$this->location->custno,
            ));
        }
       
        
    }
    public function run(){
        
        $this->render('application.components.view.LocationMenu',array(
           'contacts'=>$this->contacts,
            'customer'=>$this->customer,
            'location'=>$this->location
        ));
    }
}
?>
